package GCD
import chisel3.iotesters.{PeekPokeTester,Driver,ChiselFlatSpec}

class GCDTests(c:GCD) extends PeekPokeTester(c){
    val inputs = List((48,32),(7,3),(100,10))
    val outputs= List(16,1,10)
    
    var i = 0
    do{
        poke(c.io.a,inputs(i)._1)
        poke(c.io.b,inputs(i)._2)
        poke(c.io.load,1)
        step(1)
        poke(c.io.load,0)
        var ready = false
        do{
            ready = peek(c.io.valid)==1
            step(1)
        }while(t<100 && !ready)
        //expect(c.io.out,outputs(i))
        i += 1
    }while(t<100 && i<3)

    //if(t>=100)fail
}

object  GCDTestsGen extends App{
    chisel3.iotesters.Driver.execute(args,()=>new GCD)(c => new GCDTests(c))
}
